<?php 
	header ( "Content-type:text/html;charset=utf-8" );
	require_once('../php/db/properties.inc.php');
	session_start();
	$userInfo = $_SESSION["userInfo"];	
?>
<!DOCTYPE html>
<html >
 <head>
  <title>淡炒番茄 </title>
  <meta charset="UTF-8"/>
  <meta name="baidu-site-verification" content="qzi8QXIWmC" />
  <meta name="description" content="不知道为什么就是想写个网站玩儿，但技术不行将就用吧!"/>
  <meta name="viewport"  content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"/>
  <meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="keywords" content=""/>
  <meta name="robots" content="index,follow" />
  <meta name="full-screen" content="yes">
  <meta name="x5-fullscreen" content="true">
  <link href="../css/common.css" rel="stylesheet"/>
  <link href="../css/index.css" rel="stylesheet"/>
  <script type="text/javascript" >
  var ua = navigator.userAgent;
   window.onload = function(){ 
	  if(ua.match(/(iPhone|iPod|Android|ios)/i)){
		  $(".dfb").css("width","100%");
	  } 
   }; 
  	function longUser(){
  		window.location.href="login.php";
  	}
  </script>
 </head>
 <body class="dfb">
 	<div class="bodco bodyd" >
 		<div class="di">
 			<img src="../img/qywl.jpg" class="di "/>
 		</div>
 		<div class="dl di login" >
 			
 			<?php 
 				$html = "";
 			 	if($userInfo){
 			 		$userObject = json_decode($userInfo);
 			 		$mind = $userObject->mind;
 			 		if($userObject->head){
 			 			$html .= "<div><img src='".$userObject->head."' style='width: 80;' /></div>";
 			 		}else{
 			 			$html .= "<div><img src='../img/he.png' style='width: 80;' /></div>";
 			 		}
 			 		
 			 		$html .= "<div id='longUser' >";
 			 		$html .= "<p class='fonts font1' style='text-align:left;'>".$userObject->userName."[<a style='text-decoration: none;' href='editUserInfo.php'>修改</a>]</p>";
 			 		$html .= "<p class=' fonts font2'>".(($userObject->mind) ? $mind:"这个人很懒！啥也没说，啥也没做！")."</p>";
 			 		$html .= "</div>";
 			 		
 			 		$html .= "<div style='float: right;margin-right: 2px;'><p class='font1' style='height: 60px;'>";
 			 		$html .= "<a href='editcon.php' class='clicks' style='margin-top: 5px; text-decoration: none;'>发文>></a></p>";
 			 		$html .= "</div>";
 			 	}else{
 			 		$html .= "<div id='longUser1' id='longUser' >";
 			 		$html .= "<p class='fonts font3 dipa'><a href='javascript:void(0)' onclick='longUser()' class='clicks' style='line-height: 50px;'>登录</a></p>";
 			 		$html .= "</div>";
 			 	}
 			 	
 			 	echo $html;
 			?>
 			
 		</div>
 		<div class="dc" >
 			<div class="dcvalue" >
 				<div class="dcvaluebt"><a href="list.php?type=2" class='fonts font3 clicks'>小技术[开心就好]</a></div>
 			</div>
 			<div class="dchrd"><hr class="dchr"/></div>
 			<div class="dccont">
 				<ul>
 					<?php 
 						$conn = new mysqli($url, $user, $pwd, $dbname, $port);
						$conn -> set_charset("utf8");
						$sql = "SELECT b.id,b.title,t.userName FROM bolggerTitle b, userInfo t WHERE t.id = b.userId AND b.types=2 ORDER BY b.addTime limit 12";
						if(!$conn->connect_error){
							$results = $conn->query($sql);
							while ($row = $results->fetch_assoc()) {
						     	echo "<li><div><a href='content.php?id=".$row["id"]."' class='fonts font2 clicks'>[".$row["userName"]."]&nbsp".$row["title"]."</a></div></li>";
						    }
						    $results->free();
						}
						$conn -> close();
 					?>
 					
 				</ul>
 			</div>
 		</div>
 		<div class="dc" >
 			<div class="dcvalue" >
 				<div class="dcvaluebt"><a href="list.php?type=1" class='fonts font3 clicks'>小信息[干点啥呢]</a></div>
 			</div>
 			<div class="dchrd"><hr class="dchr"/></div>
 			<div class="dccont">
 				<ul>
 				<?php 
 						$conn = new mysqli($url, $user, $pwd, $dbname, $port);
						$conn -> set_charset("utf8");
						$sql = "SELECT b.id,b.title,t.userName FROM bolggerTitle b, userInfo t WHERE t.id = b.userId AND b.types=1 ORDER BY b.addTime limit 12";
						if(!$conn->connect_error){
							$results = $conn->query($sql);
							while ($row = $results->fetch_assoc()) {
						     	echo "<li><div><a href='content.php?id=".$row["id"]."' class='fonts font2 clicks'>[".$row["userName"]."]&nbsp".$row["title"]."</a></div></li>";
						    }
						    $results->free();
						}
						$conn -> close();
 					?>	
 				</ul>
 			</div>
 		</div>
 	</div>
 	<div class="bodco bodcohrs" ><hr class="bodyh"/></div> 
 	<div class="bodco bodyf">
 		 <p class='fonts font2'> @2008-2015 <a href="index.php" class='fonts font2 ' style="text-decoration: none;" >淡炒番茄</a> （http://www.dancfq.com/)  备案号：粤ICP备XXXXXX号 </p>
 	</div>
 </body>
</html>
